package com.ityuhao.tech.concurrency;

import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class DemoController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Autowired
    private RedissonClient redissonClient;

    @GetMapping("/send")
    public String send(String value){
        stringRedisTemplate.opsForList().rightPush("channel01",value);
        log.info("send value:{}",value);
        return "ok";
    }

    @GetMapping("/lock")
    public String lock(){

        return "Hello Redisson!";
    }

}
